﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _3._2_Grade
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int bf;
            string wj;
            bf = int.Parse(textBox1.Text);
            if (bf > 100 || bf < 0)
            {
                MessageBox.Show("非法输入！");
                textBox1.Clear();
            }
            else { 

                switch(bf/10)
                {
                    case 10:
                    case 9:
                        wj = "A";
                        break;
                    case 8:
                        wj = "B";
                        break;
                    case 7:
                        wj = "C";
                        break;
                    case 6:
                        wj = "D";
                        break;
                    default:
                        wj = "E";
                        break;
                }
                textBox2.Text = wj;
            }
            
            //}else if ( bf >= 90)
            //{
            //    textBox2.Text = "A";
            //}
            //else if (90>bf )
            //{
            //    textBox2.Text = "B";
            //}
            //else if (80 >bf )
            //{
            //    textBox2.Text = "C";
            //}
            //else if (70 >bf )
            //{
            //    textBox2.Text = "D";
            //}
            //else if (60 > bf)
            //{
            //    textBox2.Text = "E";
            //}

        
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Clear();
            textBox2.Clear();
        }
    }
}
